package com.xudu.config;

import com.xudu.interceptors.JWTInterceptors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * ClassName: InterceptorConfig
 * Description:
 *
 * @Author xudu
 * @Create 2024/4/10
 */

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Autowired
    private JWTInterceptors jwtInterceptors;


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new JWTInterceptors())
                //拦截请求路径
                .addPathPatterns("/**")
                //排除拦截路径
//                .excludePathPatterns("/user/registerWithPhoto")
//                .excludePathPatterns("/user/login");
                .excludePathPatterns("/file/savephoto")
                .excludePathPatterns("/student/**")
                .excludePathPatterns("/user/**");


    }
}
